<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
selection_test(
  '<iframe id=child></iframe>',
  selection => {
    const child = selection.document.getElementById('child');
    const childDocument = child.contentDocument;
    const textarea = childDocument.createElement('textarea');
    childDocument.body.appendChild(textarea);
    textarea.addEventListener("input", () => child.remove());
    textarea.focus();

    assert_own_property(
        window, 'textInputController',
        'This test requires textInputController to simulate IME operations');
    textInputController.setComposition("foo");
  },
  '',
  'SetComposition should not crash when event handler removes frame');
</script>
